<template>
  <div class="info">
    <!-- <el-page-header @back="$router.go(-1)" class="back"> </el-page-header> -->
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="帖子信息" name="1">
        <get-info :id="id"></get-info>
      </el-tab-pane>
      <el-tab-pane label="留言列表" name="2">
        <comment-list :comment="comment"></comment-list>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import CommentList from "@/components/CommentList";
import GetInfo from "./component/getInfo";
import { getComments } from "@/api/community";

export default {
  name: "invitationInfo",
  components: {
    CommentList,
    GetInfo,
  },
  data() {
    return {
      activeName: "1",
      comment: {},
      id: this.$route.query.id,
    };
  },
  methods: {
    async handleClick(e) {
      if (e.name == 2) {
        const res = await getComments({
          id: this.id,
        });
        if (res.data) {
          this.comment = res.data;
        }
      }
    },
  },
};
</script>
<style lang="scss" scoped>
</style>